package com.lsu.command.experiment;

import javax.swing.*;
import java.awt.*;
import java.awt.geom.Ellipse2D;

/**
 * 有能力执行命令的接收者
 *
 * @Author wang suo
 * @Date 2020/10/21 0021 15:16
 * @Version 1.0
 */
class Receiver {
    private Graphics2D graphics2D;

    void addSpot(JPanel jPanel, Circle circle) {
        Shape shape = new Ellipse2D.Double(circle.getX() - 10, circle.getY() - 10, 20, 20);
        graphics2D = (Graphics2D) jPanel.getGraphics();
        graphics2D.setPaint(Color.black);
        graphics2D.fill(shape);
    }

    void deleteSpot(JPanel jPanel, Circle circle) {
        Shape shape = new Ellipse2D.Double(circle.getX() - 10, circle.getY() - 10, 20, 20);
        graphics2D = (Graphics2D) jPanel.getGraphics();
        graphics2D.setPaint(jPanel.getBackground());
        graphics2D.fill(shape);
    }
}
